package org.setaria.control
{
	import flash.events.MouseEvent;
	
	import org.setaria.event.TabBarEvent;
	
	import spark.components.ButtonBarButton;
	
	public class ButtonBarButton extends spark.components.ButtonBarButton
	{
		public function ButtonBarButton()
		{
			super();
//			this.addEventListener(MouseEvent.CLICK,mouseHandler);
		}
		
		override protected function clickHandler(event:MouseEvent):void{
			if((this.width-event.localX)<=15 && event.localY <=15 ){
				dispatchEvent(new TabBarEvent(TabBarEvent.EVENT_CLICK_CLOSE_BUTTON,this.data,this.itemIndex));
			}
		}
		
//		/**
//		 * mouseEventHandler
//		 * **/
//		protected function mouseHandler(event:MouseEvent):void
//		{
//			switch(event.type){
//				case MouseEvent.MOUSE_OVER:
//					
//					this.currentState = "over";
//					break;
//				case MouseEvent.CLICK:
//					if((this.width-event.localX)<=15 && event.localY <=15 ){
//						dispatchEvent(new TabBarEvent(TabBarEvent.EVENT_CLICK_CLOSE_BUTTON,this.data,this.itemIndex));
//					}else{
//						dispatchEvent(new TabBarEvent(TabBarEvent.EVENT_SELECT_ITEM,this.data,this.itemIndex));
//					}
//					break;
//			}
//		}
	}
}